/*
 * @Author: szx
 * @Date: 2022-04-21 11:30:12
 * @LastEditTime: 2022-04-21 11:45:45
 * @Description:
 * @FilePath: \leetcode\800-899\824\824.js
 */
/**
 * @param {string} sentence
 * @return {string}
 */
var toGoatLatin = function (sentence) {
    const arr = sentence.split(' ');
    let tmp = '';
    return arr
        .map((v, i) => {
            tmp += 'a';
            const first = v[0].toLocaleLowerCase();
            if (!(first === 'a' || first === 'e' || first === 'i' || first === 'o' || first === 'u')) {
                v = v.substring(1) + v[0];
            }
            return v + 'ma' + tmp;
        })
        .join(' ');
};
